import { defHttp } from "@/utils/http";
// ERP 其它入库单 VO
export interface StockInVO {
	id: number; // 入库编号
	no: string; // 入库单号
	suplerId: number; // 供应商编号
	inTime: Date; // 入库时间
	totalCount: number; // 合计数量
	totalPrice: number; // 合计金额，单位：元
	status: number; // 状态
	remark: string; // 备注
}

// ERP 其它入库单 API
export const StockInApi = {
	// 查询其它入库单分页
	getStockInPage: async (params: any) => {
		return await defHttp.get({ url: `/whs/invt-stockin/page`, params });
	},

	// 查询其它入库单详情
	getStockIn: async (id: number) => {
		return await defHttp.get({ url: `/whs/invt-stockin/get?id=` + id });
	},

	// 新增其它入库单
	createStockIn: async (data: StockInVO) => {
		return await defHttp.post({ url: `/whs/invt-stockin/create`, data });
	},

	// 修改其它入库单
	updateStockIn: async (data: StockInVO) => {
		return await defHttp.put({ url: `/whs/invt-stockin/update`, data });
	},

	// 更新其它入库单的状态
	updateStockInStatus: async (id: number, status: string) => {
		return await defHttp.put({
			url: `/whs/invt-stockin/update-status`,
			params: {
				id,
				status
			}
		});
	},

	// 删除其它入库单
	deleteStockIn: async (ids: number[]) => {
		return await defHttp.delete({
			url: `/whs/invt-stockin/delete`,
			params: ids
		});
	},

	// 导出其它入库单 Excel
	exportStockIn: async (params: any) => {
		return await defHttp.download({ url: `/whs/invt-stockin/export-excel`, params });
	}
};
